﻿using Maticsoft.BLL;
using Maticsoft.DBUtility;
using Maticsoft.Model;
using System;
using System.Data;
using System.Text;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using Wuqi.Webdiyer;

public partial class WebPage_Diaocha_Fankui_Xiangqing : SystemBBasePage
{


    // Methods
    protected void AspNetPager1_PageChanged(object sender, EventArgs e)
    {
        this.getXiangqing();
    }

    private void getXiangqing()
    {
        Maticsoft.Model.vote_options _options = new Maticsoft.Model.vote_options();
        Maticsoft.Model.vote_options _options2 = new Maticsoft.Model.vote_options();
        Maticsoft.BLL.vote_feedback_question _question = new Maticsoft.BLL.vote_feedback_question();
        StringBuilder builder = new StringBuilder();
        StringBuilder builder2 = new StringBuilder();
        builder.Append("<tr >");
        builder.Append("<th width='40'>ID</th>");
        builder.Append("<th width='450'>名称</th>");
        builder.Append("<th width='100'>反馈(人次)</th>");
        builder.Append("<th width='100'>状态</th>");
        builder.Append("<th width='100'>排序</th>");
        builder.Append("<th width='50'>操作</th>");
        builder.Append("</tr>");
        string wherestr = "question_id=" + Convert.ToInt32(base.Request.QueryString["xiangqing"].ToString());
        Pagers pagers = DbHelperSQL.SelectByPager("*", wherestr, "Id desc", this.AspNetPager1.CurrentPageIndex, this.AspNetPager1.PageSize, "vote_options", "", "");
        if ((pagers != null) && (pagers.MyData.Rows.Count > 0))
        {
            this.AspNetPager1.RecordCount = pagers.TotalRecords;
            for (int i = 0; i < pagers.MyData.Rows.Count; i++)
            {
                DataRow row = pagers.MyData.Rows[i];
                if ((i % 2) != 0)
                {
                    builder2.Append("<tr>");
                }
                else
                {
                    builder2.Append("<tr class='alt'>");
                }
                builder2.Append("<td>" + row["id"] + "</td>");
                builder2.Append("<td>" + row["name"] + "</td>");
                if (_question.GetModelList("options_id=" + row["id"].ToString()).Count >= 0)
                {
                    builder2.Append("<td>" + _question.GetModelList("options_id=" + row["id"].ToString()).Count + "(人次)</td>");
                }
                else
                {
                    builder2.Append("<td>0(人次)</td>");
                }
                builder2.Append("<td>" + row["is_show"] + "</td>");
                builder2.Append("<td>" + row["order"] + "</td>");
                builder2.Append(string.Concat(new object[] { "<td><a href='Diaocha_Fankui_Xiangqing_Content.aspx?content=", row["id"], "&xiangqing=", base.Request.QueryString["xiangqing"].ToString(), "'>查看</a></td>" }));
                builder2.Append("</tr>");
            }
        }
        else
        {
            builder2.Append("<tr><td colspan=5 align='center'>无选项</td></tr>");
        }
        this.Literal1.Text = builder.ToString();
        this.Literal2.Text = builder2.ToString();
    }

    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        this.HeaderControl1.Select = "diaocha";
        this.DiaoCha1.Select = "Fankui";
        if (!base.IsPostBack && (base.Request.QueryString["xiangqing"] != null))
        {
            this.getXiangqing();
            this.Literal3.Text = "<h2>'" + base.Request.QueryString["title"].ToString() + "'反馈详情</h2>";
        }
    }

}